package com.example.demo.controller;


import com.example.demo.service.UserService;
import com.fasterxml.jackson.annotation.JsonCreator;
import org.apache.catalina.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Controller;


@Controller
public class UserController {
    // 属性注入
//    @Autowired
//    UserService userService;

    // 构造方法注入
//    UserService userService;
//    @Autowired
//    public UserController(UserService us) {
//        this.userService = us;
//    }
//
    //Setter 注入
    UserService userService;
    @Autowired
    public void setUS(UserService us) {
        this.userService = us;
    }
    public void doController() {
        userService.doService();
        System.out.println("do Controller.....");
    }
}